package com.cc.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private int code;

    private String message;

    private Object data;

    public static JsonResult success(Object data) {
        return new JsonResult(200, "success", data);
    }

    public static JsonResult error() {
        return new JsonResult(500, "error", null);
    }

    public static JsonResult build(Integer code, String message, Object data) {
        return new JsonResult(code, message, data);
    }
}
